package day05;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectionObjTest {

    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {

        Class<Person> clazz = Person.class;
        // 直接创建对象
        Person person = clazz.newInstance();

        // 获取控制器之后再新创建对象
        Constructor con1 = clazz.getConstructor();
        Person p1 = (Person) con1.newInstance();
        System.out.println(p1);
    }

}
